package com.common.utils.http;


/**
 * @author feijinbo
 * 
 */
public class AsnyTest implements AsyncHandler {

	public boolean getRequestToken(String httpMethod) {
		String url = "http://wubo123.wachoo.com/interfaces/queryTwoRelations.json";
		AsyncHttpClient asyncHttp = new AsyncHttpClient();
		String queryString = "?name=feijb&age=29";
		if ("GET".equals(httpMethod)) {
			return asyncHttp.httpPost(url, queryString, this, "AsnyTest");
		}
		return true;

	}

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub
		AsnyTest t = new AsnyTest();
		t.getRequestToken("GET");
	}

	public void onThrowable(Throwable t, Object cookie) {
		System.err.println(cookie.toString() + ":" + t.getLocalizedMessage());

	}

	public void onCompleted(int statusCode, String content, Object cookie) {
		System.out.println("success:" + cookie.toString());
		System.out.println("code:" + statusCode);
		System.out.println("content:" + content);
	}

	
}
